#!/usr/bin/python
# coding=utf-8
import os
import string
import plotly
import plotly.plotly
import plotly.figure_factory as ff
import pandas as pd
import numpy
import plotly.graph_objs as abcc  # 必须
import plotly.plotly
import random


# str = raw_input("请输入：");
# print str

one = open("/Users/Vicky/Documents/workspace/fission/long.log", "r")
print one.name
times = []
group = []
for i in range(1000):
    group.append("单线程1000次请求")
for i in range(1000):
    group.append("5个程1000次请求")
for i in range(1000):
    group.append("10个程1000次请求")
for i in range(1000):
    group.append("20个程1000次请求")
print  group.__len__()
for line in one.readlines():
   if line.strip() != "":
        # print float(line.strip())
        time = float(line)
        times.append(time)

one.close()
data = pd.DataFrame(dict(Score=times, Group=group))
fig = ff.create_violin(data, data_header='Score', group_header='Group', height=700, width=1200,
                       title="获取评论接口测试时间")
plotly.offline.plot(fig)



# listx = []
# length = linewwew.__len__()
# for i in range(length):
#     listx.append(i)
# data_1 = abcc.Scatter(
#     x=listx,
#     y=linewwew,
#     name='test1'
# )
# data11 = [data_1]
# plotly.offline.plot(data11)